nethackfandomcom-20200214-history
Source:NetHack 3.4.0/global.h
Below is the full text to global.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/global.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)global.h 3.4 2002/03/12 */ 2. /* Copyright © Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef GLOBAL_H 6. #define GLOBAL_H 7. 8. #include 9. 10. 11. /* #define BETA */ /* if a beta-test copy MRS */ 12. 13. /* 14. * Files expected to exist in the playground directory. 15. */ 16. 17. #define RECORD "record" /* file containing list of topscorers */ 18. #define HELP "help" /* file containing command descriptions */ 19. #define SHELP "hh" /* abbreviated form of the same */ 20. #define DEBUGHELP "wizhelp" /* file containing debug mode cmds */ 21. #define RUMORFILE "rumors" /* file with fortune cookies */ 22. #define ORACLEFILE "oracles" /* file with oracular information */ 23. #define DATAFILE "data" /* file giving the meaning of symbols used */ 24. #define CMDHELPFILE "cmdhelp" /* file telling what commands do */ 25. #define HISTORY "history" /* file giving nethack's history */ 26. #define LICENSE "license" /* file with license information */ 27. #define OPTIONFILE "opthelp" /* file explaining runtime options */ 28. #define OPTIONS_USED "options" /* compile-time options, for #version */ 29. 30. #define LEV_EXT ".lev" /* extension for special level files */ 31. 32. 33. /* Assorted definitions that may depend on selections in config.h. */ 34. 35. /* 36. * for DUMB preprocessor and compiler, e.g., cpp and pcc supplied 37. * with Microport SysV/AT, which have small symbol tables; 38. * DUMB if needed is defined in CFLAGS 39. */ 40. #ifdef DUMB 41. #ifdef BITFIELDS 42. #undef BITFIELDS 43. #endif 44. #ifndef STUPID 45. #define STUPID 46. #endif 47. #endif /* DUMB */ 48. 49. /* 50. * type xchar: small integers in the range 0 - 127, usually coordinates 51. * although they are nonnegative they must not be declared unsigned 52. * since otherwise comparisons with signed quantities are done incorrectly 53. */ 54. typedef schar xchar; 55. #ifndef SKIP_BOOLEAN 56. typedef xchar boolean; /* 0 or 1 */ 57. #endif 58. 59. #ifndef TRUE /* defined in some systems' native include files */ 60. #define TRUE ((boolean)1) 61. #define FALSE ((boolean)0) 62. #endif 63. 64. #ifndef STRNCMPI 65. # ifndef __SASC_60 /* SAS/C already shifts to stricmp */ 66. # define strcmpi(a,b) strncmpi((a),(b),-1) 67. # endif 68. #endif 69. 70. /* comment out to test effects of each #define -- these will probably 71. * disappear eventually 72. */ 73. #ifdef INTERNAL_COMP 74. # define RLECOMP /* run-length compression of levl array - JLee */ 75. # define ZEROCOMP /* zero-run compression of everything - Olaf Seibert */ 76. #endif 77. 78. /* #define SPECIALIZATION */ /* do "specialized" version of new topology */ 79. 80. 81. #ifdef BITFIELDS 82. #define Bitfield(x,n) unsigned x:n 83. #else 84. #define Bitfield(x,n) uchar x 85. #endif 86. 87. #ifdef UNWIDENED_PROTOTYPES 88. # define CHAR_P char 89. # define SCHAR_P schar 90. # define UCHAR_P uchar 91. # define XCHAR_P xchar 92. # define SHORT_P short 93. #ifndef SKIP_BOOLEAN 94. # define BOOLEAN_P boolean 95. #endif 96. # define ALIGNTYP_P aligntyp 97. #else 98. # ifdef WIDENED_PROTOTYPES 99. # define CHAR_P int 100. # define SCHAR_P int 101. # define UCHAR_P int 102. # define XCHAR_P int 103. # define SHORT_P int 104. # define BOOLEAN_P int 105. # define ALIGNTYP_P int 106. # endif 107. #endif 108. #if defined(ULTRIX_PROTO) && !defined(__STDC__) 109. /* The ultrix 2.0 and 2.1 compilers (on Ultrix 4.0 and 4.2 respectively) can't 110. * handle "struct obj *" constructs in prototypes. Their bugs are different, 111. * but both seem to work if we put "void*" in the prototype instead. This 112. * gives us minimal prototype checking but avoids the compiler bugs. 113. * 114. * OBJ_P and MONST_P should _only_ be used for declaring function pointers. 115. */ 116. #define OBJ_P void* 117. #define MONST_P void* 118. #else 119. #define OBJ_P struct obj* 120. #define MONST_P struct monst* 121. #endif 122. 123. #define SIZE(x) (int)(sizeof(x) / sizeof(x0)) 124. 125. 126. /* A limit for some NetHack int variables. It need not, and for comparable 127. * scoring should not, depend on the actual limit on integers for a 128. * particular machine, although it is set to the minimum required maximum 129. * signed integer for C (2^15 -1). 130. */ 131. #define LARGEST_INT 32767 132. 133. 134. #ifdef REDO 135. #define Getchar pgetchar 136. #endif 137. 138. 139. #include "coord.h" 140. /* 141. * Automatic inclusions for the subsidiary files. 142. * Please don't change the order. It does matter. 143. */ 144. 145. #ifdef VMS 146. #include "vmsconf.h" 147. #endif 148. 149. #ifdef UNIX 150. #include "unixconf.h" 151. #endif 152. 153. #ifdef OS2 154. #include "os2conf.h" 155. #endif 156. 157. #ifdef MSDOS 158. #include "pcconf.h" 159. #endif 160. 161. #ifdef TOS 162. #include "tosconf.h" 163. #endif 164. 165. #ifdef AMIGA 166. #include "amiconf.h" 167. #endif 168. 169. #ifdef MAC 170. #include "macconf.h" 171. #endif 172. 173. #ifdef __BEOS__ 174. #include "beconf.h" 175. #endif 176. 177. #ifdef WIN32 178. #include "ntconf.h" 179. #endif 180. 181. /* Displayable name of this port; don't redefine if defined in *conf.h */ 182. #ifndef PORT_ID 183. # ifdef AMIGA 184. # define PORT_ID "Amiga" 185. # endif 186. # ifdef MAC 187. # define PORT_ID "Mac" 188. # endif 189. # ifdef MSDOS 190. # ifdef PC9800 191. # define PORT_ID "PC-9800" 192. # else 193. # define PORT_ID "PC" 194. # endif 195. # ifdef DJGPP 196. # define PORT_SUB_ID "djgpp" 197. # else 198. # ifdef OVERLAY 199. # define PORT_SUB_ID "overlaid" 200. # else 201. # define PORT_SUB_ID "non-overlaid" 202. # endif 203. # endif 204. # endif 205. # ifdef OS2 206. # define PORT_ID "OS/2" 207. # endif 208. # ifdef TOS 209. # define PORT_ID "ST" 210. # endif 211. # ifdef UNIX 212. # define PORT_ID "Unix" 213. # endif 214. # ifdef VMS 215. # define PORT_ID "VMS" 216. # endif 217. # ifdef WIN32 218. # define PORT_ID "Windows" 219. # ifdef MSWIN_GRAPHICS 220. # define PORT_SUB_ID "graphical" 221. # else 222. # define PORT_SUB_ID "tty" 223. # endif 224. # endif 225. #endif 226. 227. #if defined(MICRO) 228. #if !defined(AMIGA) && !defined(TOS) && !defined(OS2_HPFS) && !defined(WIN32) 229. #define SHORT_FILENAMES /* filenames are 8.3 */ 230. #endif 231. #endif 232. 233. #ifdef VMS 234. /* vms_exit() (sys/vms/vmsmisc.c) expects the non-VMS EXIT_xxx values below. 235. * these definitions allow all systems to be treated uniformly, provided 236. * main() routines do not terminate with return(), whose value is not 237. * so massaged. 238. */ 239. # ifdef EXIT_SUCCESS 240. # undef EXIT_SUCCESS 241. # endif 242. # ifdef EXIT_FAILURE 243. # undef EXIT_FAILURE 244. # endif 245. #endif 246. 247. #ifndef EXIT_SUCCESS 248. # define EXIT_SUCCESS 0 249. #endif 250. #ifndef EXIT_FAILURE 251. # define EXIT_FAILURE 1 252. #endif 253. 254. #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) || defined(MSWIN_GRAPHICS) 255. # ifndef USE_TILES 256. # define USE_TILES /* glyph2tile[] will be available */ 257. # endif 258. #endif 259. #if defined(AMII_GRAPHICS) || defined(GEM_GRAPHICS) 260. # ifndef USE_TILES 261. # define USE_TILES 262. # endif 263. #endif 264. 265. 266. #define Sprintf (void) sprintf 267. #define Strcat (void) strcat 268. #define Strcpy (void) strcpy 269. #ifdef NEED_VARARGS 270. #define Vprintf (void) vprintf 271. #define Vfprintf (void) vfprintf 272. #define Vsprintf (void) vsprintf 273. #endif 274. 275. 276. /* primitive memory leak debugging; see alloc.c */ 277. #ifdef MONITOR_HEAP 278. extern long *FDECL(nhalloc, (unsigned int,const char *,int)); 279. extern void FDECL(nhfree, (genericptr_t,const char *,int)); 280. # ifndef __FILE__ 281. # define __FILE__ "" 282. # endif 283. # ifndef __LINE__ 284. # define __LINE__ 0 285. # endif 286. # define alloc(a) nhalloc(a,__FILE__,(int)__LINE__) 287. # define free(a) nhfree(a,__FILE__,(int)__LINE__) 288. #else /* !MONITOR_HEAP */ 289. extern long *FDECL(alloc, (unsigned int)); /* alloc.c */ 290. #endif 291. 292. /* Used for consistency checks of various data files; declare it here so 293. that utility programs which include config.h but not hack.h can see it. */ 294. struct version_info { 295. unsigned long incarnation; /* actual version number */ 296. unsigned long feature_set; /* bitmask of config settings */ 297. unsigned long entity_count; /* # of monsters and objects */ 298. unsigned long struct_sizes; /* size of key structs */ 299. }; 300. 301. 302. /* 303. * Configurable internal parameters. 304. * 305. * Please be very careful if you are going to change one of these. Any 306. * changes in these parameters, unless properly done, can render the 307. * executable inoperative. 308. */ 309. 310. /* size of terminal screen is (at least) (ROWNO+3) by COLNO */ 311. #define COLNO 80 312. #define ROWNO 21 313. 314. #define MAXNROFROOMS 40 /* max number of rooms per level */ 315. #define MAX_SUBROOMS 24 /* max # of subrooms in a given room */ 316. #define DOORMAX 120 /* max number of doors per level */ 317. 318. #define BUFSZ 256 /* for getlin buffers */ 319. #define QBUFSZ 128 /* for building question text */ 320. #define TBUFSZ 300 /* toplines[] buffer max msg: 3 81char names */ 321. /* plus longest prefix plus a few extra words */ 322. 323. #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 324. #define PL_CSIZ 32 /* sizeof pl_character */ 325. #define PL_FSIZ 32 /* fruit name */ 326. #define PL_PSIZ 63 /* player-given names for pets, other 327. * monsters, objects */ 328. 329. #define MAXDUNGEON 16 /* current maximum number of dungeons */ 330. #define MAXLEVEL 32 /* max number of levels in one dungeon */ 331. #define MAXSTAIRS 1 /* max # of special stairways in a dungeon */ 332. #define ALIGNWEIGHT 4 /* generation weight of alignment */ 333. 334. #define MAXULEV 30 /* max character experience level */ 335. 336. #define MAXMONNO 120 /* geno monst after this number killed */ 337. #define MHPMAX 500 /* maximum monster hp */ 338. 339. #endif /* GLOBAL_H */ global.h